<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class ScoreResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        //return parent::toArray($request);
        return [
            'score' => $this->total_score,
            'rate' => [
                'min' => $this->score_rank->min_interests,
                'max' => $this->score_rank->max_interests,
                'score_rank' => $this->score_rank->score_rank,
                'message' => $this->score_rank->message,
            ],
            'loan_amount' => [
                'min' => $this->min_total_payment,
                'max' => $this->max_total_payment,
            ],
            'customer_history_id' => $this->id,

        ];
    }
}
